class Money {
    private int fAmount;
    private String fCurrency;

    public Money(int amount, String currency) {
        fAmount = amount;
        fCurrency = currency;
    }

    public int amount() {
        return fAmount;
    }

    public String currency() {
        return fCurrency;
    }

    public Money add(Money m) {
        return new Money(amount()+m.amount(), currency());
    }

    public boolean equals(Object anObject) {
        if(anObject instanceof Money) {
            Money aMoney = (Money)anObject;
            return aMoney.currency().equals(currency())
                && aMoney.amount() == amount();
        }
        return false;
    }
}

public class MoneyTest extends TestCase{
    private Money f12CHF;
    private Money f14CHF;

    protected void setUp() {
        f12CHF = new Money(12, "CHF");
        f14CHF = new Money(14, "CHF");
    }

    public void testSimpleAdd() {
        Money expected = new Money(26, "CHF");
        Money result = f12CHF.add(f14CHF);
        Assert.assertTrue(expected.equals(result));
    }

    public void testEquals() {
        Assert.assertTrue(! f12CHF.equals(null));
        Assert.assertEquals(f12CHF, f14CHF);
        Assert.assertEquals(f12CHF, new Money(12, "CHF"));
        Assert.assertTrue(! f12CHF.equals(f14CHF));
    }
}

public static Test suite() {
    return new TestSuite(MoneyTest.class);
}
